package com.mysite.springbootdemo.service;

import com.mysite.springbootdemo.mapper.AcOperatorMapper;
import com.mysite.springbootdemo.po.AcOperator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
public class OperatorService {

	@Autowired
	private AcOperatorMapper operatorMapper;

	public List<AcOperator> getOperators(Map<String, Object> searchMap) {
		return operatorMapper.getOperators(searchMap);
	}

	@Transactional
	public String register(String usercode) {
		AcOperator operator = new AcOperator();
		operator.setUsercode(usercode);
		operator.setUsername(usercode);
		operatorMapper.insert(operator);
		operatorMapper.getOperators(null);
		return usercode;
	}
}